package cn.yunhe.services;

import cn.yunhe.dao.IFoodDaoMapper;
import cn.yunhe.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * 周依博
 */
public class DeleteFoodService {
    SqlSession session = null;
    IFoodDaoMapper foodDaoMapper =null;
    public int deleteFood(int fid){
        int result;
        try{
             session = SqlSessionFactoryUtil.getSqlSession();
             foodDaoMapper =session.getMapper(IFoodDaoMapper.class);
            result= foodDaoMapper.deleteFood(fid);
            session.commit();
        }finally {
            session.close();
        }
       return result;
    }
}
